dict1 = {'id': '1', 'name': 'zs', 'age': 18}
dict1['address'] = '府东路'
dict1['address'] = '瓯江口'
del dict1['address']
print(dict1['name'])
print(dict1.keys())
print(dict1.values())
print(dict1.items())

# 遍历
# 1）遍历所有键，根据key得到值
for k in dict1.keys():
    print(f'{k}---{dict1.get(k)}')

# 2）遍历所有键值对、根据键值对得到键和值
for k, v in dict1.items():
    print(f'{k}:{v}')

# 3)遍历所有键值对、根据键值对得到键值对
for item in dict1.items():
    # item键值对是元组类型
    print(item)
    # print(type(item))

# 清空：字典变成空字典
dict1.clear()

# 删除：字典不存在，就不能在使用了
del dict1
